<?php
include "connection.php";
include "GoogleGeolocation.php";
//$con = mysql_connect("localhost","root","");
//if (!$con)
  //{
  //die('Could not connect: ' . mysql_error());
  //}
  //mysql_select_db("loc_fil", $con);
 error_reporting (NULL); 
  session_start();
 $txt=$_POST['Cat'];
//echo "You are looking for ";
//echo $txt;
//echo "<br/>";
  //$_SESSION['lat']
  $lat=$_POST['latitude'];
  //$_SESSION['val']
  //$llat=$lat-5; //$_SESSION['lat']-5;
  //$_SESSION['val1']=$_SESSION['lat']+5;
 // $hlat=$lat+5;
  //$_SESSION['lon']
  $lon=$_POST['longitude'];
  //$_SESSION['val2']=$_SESSION['lon']-5;
  //$_SESSION['val3']=$_SESSION['lon']+5;
  //$llon=$lon-5;
  //$hlon=$lon+5;
  $address = $_POST['place'];
  if (isset($txt))
  {  
	if(isset($address)&&$address!="")
	{
       $location = New GoogleGeolocation;
       $location->setAddress($address);
       $result = $location->search(); 	
       //print_r($result);
       $lat = $result['results'][0]['geometry']['location']['lat'];
       $lon = $result['results'][0]['geometry']['location']['lng'];
      // print "Result:".$lat.$long;	
	}

	include ("parks_search1.php");//includes the result from the sql query in a xml DOM structure
	$x=parksresult($txt,$lat,$lon);//function in parks_search1.php
	sendXMLResponse($x);
  }
  else {
  	if(isset($address))
	{
	echo "Address:".$address;
       $location = New GoogleGeolocation;
       $location->setAddress($address);
       $result = $location->search();
       print_r($result); 	
       echo "Result:".$result['results'][0]['geometry']['location']['lat'];	
	}
   	 include ("parks_search1.php");//includes the result from the sql query in a xml DOM structure
	 $x=parksresult("theaters","32.715329","-117.157255");//function in parks_search1.php
	 sendXMLResponse($x);
	 }
mysql_close($con);
?>

 
  